package com.appleyk.sso.dao.repo;

import com.appleyk.sso.dao.entity.PurviewDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * <p>越努力，越幸运</p>
 *
 * @author appleyk
 * @version V.0.1.1
 * @blob https://blog.csdn.net/appleyk
 * @date created on  10:21 下午 2021/1/11
 */
public interface PurviewRepo extends JpaRepository<PurviewDto,Long> {
    @Query(value="SELECT * from t_purview WHERE id IN " +
            "( SELECT pid FROM t_role_purview WHERE " +
            "rid = ( SELECT rid FROM t_user_role WHERE uid = ?1))",nativeQuery = true)
    List<PurviewDto> findPurviewsByUid(Long uid);
}
